Conversation
| pub fn downgrade_from_v29<T: BeaconChainTypes>( | ||
| _d: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>, | ||
| ) -> Result<Vec<KeyValueStoreOp>, Error> { | ||
| Err(Error::MigrationError("Cannot downgrade from v29: Redb file format upgrade is irreversible".to_string())) |
There was a problem hiding this comment.
I think the downgrade should only fail if redb is enabled and the database backend is redb
In all other cases it should just be a no-op
|
Just wanted to document here that redb https://docs.rs/redb/2.6.2/src/redb/db.rs.html#1202-1220 So once we push this change, new redb databases will be using the correct v3 format as well |
eserilev
left a comment
There was a problem hiding this comment.
Thanks for sticking through with this! This looks really good, mostly just have some things to remove
| pub fn upgrade_to_v29<T: BeaconChainTypes>( | ||
| db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>, | ||
| ) -> Result<Vec<KeyValueStoreOp>, Error> { | ||
| if db.is_redb() { |
There was a problem hiding this comment.
this was nice for testing, but we no longer need this, you can just call upgrade
| } | ||
| #[cfg(feature = "redb")] | ||
| BeaconNodeBackend::Redb(redb) => { | ||
| info!("Running Redb v29 migration"); |
There was a problem hiding this comment.
Lets update to this log to "Updating Redb file format to v3"
| match self { | ||
| #[cfg(feature = "leveldb")] | ||
| BeaconNodeBackend::LevelDb(_) => { | ||
| info!("LevelDB upgrade: no migration needed"); |
There was a problem hiding this comment.
Lets update this log to "LevelDB, no upgrade required" and downgrade this log to debug
| #[cfg(feature = "redb")] | ||
| let _database_backend = DatabaseBackend::Redb; | ||
| #[cfg(feature = "leveldb")] | ||
| let database_backend = DatabaseBackend::LevelDb; | ||
|
|
There was a problem hiding this comment.
sorry, this must be something I pushed up, we can remove this
| /// Chain spec. | ||
| pub spec: Arc<ChainSpec>, | ||
| /// Database backend type | ||
| pub database_backend: Option<DatabaseBackend>, |
| @@ -1,3 +1,5 @@ | |||
| #[cfg(feature = "redb")] | |||
| use crate::config::DatabaseBackend; | |||
| config, | ||
| hierarchy, | ||
| spec, | ||
| database_backend: None, |
| config, | ||
| hierarchy, | ||
| spec, | ||
| database_backend: Some(database_backend), |
lighthouse/Cargo.toml
Outdated
|
|
||
| [features] | ||
| default = ["slasher-lmdb", "beacon-node-leveldb"] | ||
| default = ["slasher-lmdb", "beacon-node-redb"] |
There was a problem hiding this comment.
set default back to leveldb (sorry I think I pushed up this change)
| #[cfg(feature = "redb")] | ||
| BeaconNodeBackend::Redb(redb) => { | ||
| info!("Updating Redb file format to v3"); | ||
| redb.upgrade()?; |
There was a problem hiding this comment.
note thta upgrade returns true is successful and false if its already in the v3 format
https://docs.rs/redb/2.6.2/redb/struct.Database.html#method.upgrade
In all other failure cases it will raise an error
There was a problem hiding this comment.
LGTM!
@michaelsproul whenever you have a chance, would be great to get your review as well. Thanks!
|
Some required checks have failed. Could you please take a look @owanikin? 🙏 |
|
@owanikin we have a small ci failure, can you run |
|
Some required checks have failed. Could you please take a look @owanikin? 🙏 |
|
Some required checks have failed. Could you please take a look @owanikin? 🙏 |
|
Hi @owanikin, this pull request has been closed automatically due to 30 days of inactivity. If you’d like to continue working on it, feel free to reopen at any time. |
Issue Addressed
#7911
Proposed Changes
v29for Redb file-format upgrade.migration_schema_v29.rswith:redbfeature.schema_change.rs.